<% add_decidim_meta_tags(
     description: decidim_sanitize_translated(election.description),
     title: present(election).title,
     url: election_url(election.id),
     resource: election) %>

<%
  edit_link(
    resource_locator(election).edit,
    :update,
    :election,
    election: election
  )
%>

<% append_stylesheet_pack_tag "decidim_elections", media: "all" %>
<% append_javascript_pack_tag "decidim_elections" %>

<% content_for :aside do %>
  <%= render partial: "election_aside" %>
<% end %>

<%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: elections_path } do %>

  <section class="layout-main__section layout-main__heading">
    <%= render partial: "election_top" %>

    <h1 class="h2 decorator">
      <%== present(election).title(html_escape: true) %>
    </h1>
    <div class="editor-content">
      <p><%= decidim_sanitize_editor_admin(translated_attribute(election.description)) %></p>
    </div>
  </section>

  <section class="layout-main__section">
    <%= cell "decidim/tab_panels", tab_panel_items %>
  </section>

  <section class="layout-main__section">
    <div class="questions-list"><%= render partial: "questions" %></div>
  </section>

  <% if election.published_results? %>
    <section class="layout-main__section">
      <div class="results-list"><%= render partial: "vote_results", locals: { questions: election.result_published_questions } %></div>
    </section>
  <% end %>
<% end %>
